package com.wang.demo03;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @Author 19225
 * @create 2020/12/7 14:54
 */
public class ProxyInvocationHandler implements InvocationHandler {

    public Rent rent;

    public void setRent(Rent rent) {
        this.rent = rent;
    }

    public Object getProxy()
    {
        return Proxy.newProxyInstance(this.getClass().getClassLoader(),rent.getClass().getInterfaces(),this);
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object invoke = method.invoke(rent, args);
        return invoke;
    }
}
